
import { useEffect } from 'react';
import {useGetGoodDetilQuery,Goods } from '../store/apiSlice';
interface PostExcerptProps {
    goods: Goods
  }
  interface PostExcerptProps {
    goods: Goods
  }

const GoodsForm = ({ goods }: PostExcerptProps) => {
    const { data:dts,isFetching:isFetching,isError:isError2 } = useGetGoodDetilQuery(goods.id || 1);
    useEffect(() => {
        if (isFetching) {
            // const containerClassname = classnames('posts-container', {
            //   disabled: isFetching
            // })
            console.log(dts);
            // content = <div className={containerClassname}>{renderedPosts}</div>
          } else if (isError2) {
            // console.error('Failed to fetch post details: ', error);
          }
    },[isFetching]);

    return (
        <>
        <table>
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>Price</th>
                </tr>
            </thead>
            <tbody>

                <tr>
                    <td>{dts?.data.id}</td>
                    <td>{dts?.data.name}{dts?.data.name}</td>
                    <td>{dts?.data.price}</td>
                </tr>
            </tbody>
        </table>

        </>
    )
};
export default GoodsForm;